<%-- 
    Document   : main
    Created on : 22/05/2010, 15:00:21
    Author     : leoomoreira
--%>

<%@include file="header.jsp" %>

<script type="text/javascript" src="js/main.js"></script>
<script>
    var queryTableTitle = '<fmt:message key="main.query.table.title"/>';
    var queryTableAlbum = '<fmt:message key="default.album"/>';
    var queryTableUser = '<fmt:message key="default.user"/>';
    var queryTableTotal = '<fmt:message key="main.query.table.totalfigures"/>';
    var queryTableOwned = '<fmt:message key="main.query.table.figureowned"/>';
    var queryTableMissing = '<fmt:message key="main.query.table.figuremissing"/>';
    var queryTablePercentage = '<fmt:message key="main.query.table.percentage"/>';

    var defaultNone = '<fmt:message key="default.none"/>';
    var suggestionYouNeed = '<fmt:message key="main.suggestion.youneed"/>';
    var suggestionYouExchange = '<fmt:message key="main.suggestion.youexchange"/>';
</script>

<% java.util.List<fullalbum.bean.UserAlbum> yourAlbumList = (java.util.List<fullalbum.bean.UserAlbum>) request.getAttribute("yourAlbumList");%>
<% java.util.List<fullalbum.bean.UserAlbum> usersAlbumList = (java.util.List<fullalbum.bean.UserAlbum>) request.getAttribute("usersAlbumList"); %>
<table>
    <tr>
        <td colspan="5">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td><img src="images/eye.png" />&nbsp;&nbsp;</td>
                    <td><b><fmt:message key="main.see.title"/></b></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td><fmt:message key="main.see.youralbum"/>:</td>
        <td>
            <select id="yourAlbum" name="yourAlbum" onchange="selectAlbum(this);">
                <option value=""><fmt:message key="default.select"/>...</option>
                <% for (int i = 0; i < yourAlbumList.size(); i++) {%>
                <% fullalbum.bean.UserAlbum userAlbum = (fullalbum.bean.UserAlbum) yourAlbumList.get(i);%>
                <option value="<%= userAlbum.getAlbum().getId()%>"><%= userAlbum.getAlbum().getName()%></option>
                <% }%>
            </select>
        </td>
        <td>
            <fmt:message key="default.or"/>
        </td>
        <td><fmt:message key="main.see.usersalbum"/>:</td>
        <td>
            <select id="usersAlbum" name="usersAlbum" onchange="selectUsersAlbum(this);">
                <option value=""><fmt:message key="default.select"/>...</option>
                <% for (int i = 0; i < usersAlbumList.size(); i++) {%>
                <% fullalbum.bean.UserAlbum userAlbum = (fullalbum.bean.UserAlbum) usersAlbumList.get(i);%>
                <option value="<%= userAlbum.getUser().getId() + "@" + userAlbum.getAlbum().getId() %>"><%= userAlbum.getUser().getName() + " - " + userAlbum.getAlbum().getName() %></option>
                <% }%>
            </select>
        </td>
    </tr>
</table>
<br />
<table>
    <tr>
        <td colspan="5">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td><img src="images/find.png" />&nbsp;&nbsp;</td>
                    <td><b><fmt:message key="main.query.title"/></b></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td><fmt:message key="main.query.album"/>:</td>
        <td>
            <input type="text" name="queryAlbum" id="queryAlbum" size="50" />
        </td>
        <td></td>
    </tr>
    <tr>
        <td><fmt:message key="main.query.user"/>:</td>
        <td>
            <input type="text" name="queryUser" id="queryUser" size="50" />
        </td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td colspan="2" align="left">
            <input type="button" name="querySubmit" id="querySubmit" onclick="javascript:submitQuery($('queryAlbum').value, $('queryUser').value);" value="<fmt:message key="main.query.find"/>" />
            <input type="button" name="queryReset" id="queryReset" onclick="javascript:resetQuery();" value="<fmt:message key="main.query.reset"/>" />
        </td>
    </tr>
</table>
<div id="queryResult" style="display: none;"></div>
<br />
<% java.util.List<fullalbum.vo.RepeatedFigureSuggestedVO> repeatedFigureSuggested = (java.util.List<fullalbum.vo.RepeatedFigureSuggestedVO>) request.getAttribute("repeatedFigureSuggested"); %>
<% if (repeatedFigureSuggested != null && repeatedFigureSuggested.size() > 0) { %>
<table>
    <tr>
        <td>
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td><img src="images/pictures.png" />&nbsp;&nbsp;</td>
                    <td><b><fmt:message key="main.suggestion.title"/></b></td>
                </tr>
            </table>
        </td>
    </tr>
</table>
    <% for (int i = 0; i < repeatedFigureSuggested.size(); i++) {%>
        <% fullalbum.vo.RepeatedFigureSuggestedVO repeatedFigureSuggestedVO = (fullalbum.vo.RepeatedFigureSuggestedVO) repeatedFigureSuggested.get(i);%>
        <% int albumFigureCount = 0; %>
        <table width="720">
            <tr>
                <td><fmt:message key="main.suggestion.album"/>: <b><%= repeatedFigureSuggestedVO.getAlbumName() %></b></td>
            </tr>
        </table>
        <br/>
        <table width="720">
        <% java.util.List<fullalbum.vo.UserRepeatedFigureSuggestedVO> userRepeatedFigureSuggestedList = (java.util.List<fullalbum.vo.UserRepeatedFigureSuggestedVO>) repeatedFigureSuggestedVO.getUserRepeatedFigureSuggestedList(); %>
        <% for (int j = 0; j < userRepeatedFigureSuggestedList.size(); j++) { %>
            <% fullalbum.vo.UserRepeatedFigureSuggestedVO userRepeatedFigureSuggestedVO = userRepeatedFigureSuggestedList.get(j); %>
            <% albumFigureCount += userRepeatedFigureSuggestedVO.getRepeatedFigureCount(); %>
            <tr>
                <td width="120"><fmt:message key="main.suggestion.user"/>: </td>
                <td><b><%= userRepeatedFigureSuggestedVO.getUserName() %></b></td>
            </tr>
            <tr>
                <td><fmt:message key="main.suggestion.totalyouneed"/>: </td>
                <td style="color: #0000ff;"><b><%= userRepeatedFigureSuggestedVO.getRepeatedFigureCount() %></b></td>
            </tr>
            <tr>
                <td><fmt:message key="main.suggestion.totalyouexchange"/>: </td>
                <td style="color: #ff0000;"><b><%= userRepeatedFigureSuggestedVO.getExchangeFigureCount() %></b></td>                
            </tr>
            <tr>
                <td align="center" colspan="2">
                    <table>
                        <tr>
                            <td><a href="ShowUserAlbumServlet?userId=<%= userRepeatedFigureSuggestedVO.getUserId() %>&albumId=<%= repeatedFigureSuggestedVO.getAlbumId() %>"><img src="images/report_user.png" border="0" /></a></td>
                            <td><a href="ShowUserAlbumServlet?userId=<%= userRepeatedFigureSuggestedVO.getUserId() %>&albumId=<%= repeatedFigureSuggestedVO.getAlbumId() %>"><fmt:message key="main.suggestion.seeusersalbum"/></a></td>
                            <td>|</td>
                            <td><a href="javascript:showUserRepeatedFigureSuggest('<%= userRepeatedFigureSuggestedVO.getUserId() %>', '<%= userRepeatedFigureSuggestedVO.getUserName() %>', '<%= repeatedFigureSuggestedVO.getAlbumId() %>', '<%= repeatedFigureSuggestedVO.getAlbumName() %>');"><img src="images/lupa.png" border="0" /></a></td>
                            <td><a href="javascript:showUserRepeatedFigureSuggest('<%= userRepeatedFigureSuggestedVO.getUserId() %>', '<%= userRepeatedFigureSuggestedVO.getUserName() %>', '<%= repeatedFigureSuggestedVO.getAlbumId() %>', '<%= repeatedFigureSuggestedVO.getAlbumName() %>');"><fmt:message key="main.suggestion.showorhidefiguredetails"/></a></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="padding: 0px; border-spacing: 0px; border-bottom-style: solid; border-color: #c3c3c3; border-width: 1px;" colspan="2" id="td_<%= userRepeatedFigureSuggestedVO.getUserId() %>_<%= repeatedFigureSuggestedVO.getAlbumId() %>">
                    <div style="display: none; padding: 0px; border-spacing: 0px; border-width: 0px;" id="div_<%= userRepeatedFigureSuggestedVO.getUserId() %>_<%= repeatedFigureSuggestedVO.getAlbumId() %>"></div>
                </td>
            </tr>
        <% } %>
        </table>
        <table>
            <tr>
                <td><fmt:message key="main.suggestion.totalalbum"/>: <b><%= albumFigureCount %></b></td>
            </tr>
        </table>
    <% } %>
<% } %>
<%@include file="footer.jsp" %>